RtOpenSemaphore

RtOpenSemaphore returns a handle of an existing named semaphore object.

Syntax

HANDLE RtOpenSemaphore(
    DWORD DesiredAccess,
    BOOL bInheritHandle,
    LPCTSTR lpName
);

Parameters

DesiredAccess

Ignored. The access to the semaphore object. The function fails if the security descriptor of the specified object does not permit the requested access for the calling process.

bInheritHandle

This must be FALSE.

lpName

A pointer to a null-terminated string that names the semaphore to be opened. Name comparisons are case-sensitive.

Return Values

A handle to the semaphore object if the function succeeds, NULL if the function fails

To get extended error information, call GetLastError.

Remarks

RtOpenSemaphore enables multiple processes to open handles of the same semaphore object. The function succeeds only if some process has already created the semaphore by using RtCreateSemaphore. The calling process can use the returned handle in any function that requires a handle of a semaphore object, such as a wait function, subject to the limitations of the access specified in DesiredAccess.

Use RtCloseHandle to close the handle. The system closes the handle automatically when the process terminates. The semaphore object is destroyed when its last handle has been closed.

Requirements

Header Rtapi.h
Library rtapi_w32.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtCloseHandle

RtReleaseSemaphore

IntervalZero.com | Support | Give Feedback